package com.huaxonline.boot.sign.sdk;

/**
 * 签名相关常量
 * @author zhaoshulei
 * @since 2023/9/13
 */
public class SignConstants {
    
    /**
     * 请求头常量
     */
    public static final String HEADER_APP_ID = "AppId";
    public static final String HEADER_SECRET = "Secret";
    public static final String HEADER_TIMESTAMP = "Timestamp";
    public static final String HEADER_NONCE = "Nonce";
    public static final String HEADER_SIGNATURE = "Signature";
    public static final String HEADER_HASHED_REQUEST_PAYLOAD = "HashedRequestPayload";
    
    /**
     * 签名算法类型
     */
    public static final String ALGORITHM_SHA256 = "SHA256";
    public static final String ALGORITHM_MD5 = "MD5";
    public static final String ALGORITHM_HMAC_SHA256 = "HMAC-SHA256";
    
    /**
     * 默认配置
     */
    public static final long DEFAULT_TIMESTAMP_DISPARITY = 900000L; // 15分钟
    public static final long DEFAULT_SECRET_CACHE_EXPIRE = 3600L; // 1小时
    public static final long DEFAULT_NONCE_EXPIRE_MULTIPLIER = 2L; // nonce过期时间倍数
    
    /**
     * 错误信息
     */
    public static final String ERROR_APP_ID_BLANK = "AppId不能为空";
    public static final String ERROR_TIMESTAMP_BLANK = "Timestamp不能为空";
    public static final String ERROR_NONCE_BLANK = "Nonce不能为空";
    public static final String ERROR_SIGNATURE_BLANK = "Signature不能为空";
    public static final String ERROR_APP_ID_NO_PERMISSION = "AppId无权限";
    public static final String ERROR_TIMESTAMP_EXCEED_LIMIT = "Timestamp超出允许范围";
    public static final String ERROR_NONCE_REPEATED = "Nonce重复使用";
    public static final String ERROR_SIGNATURE_INVALID = "签名验证失败";
    public static final String ERROR_UNSUPPORTED_METHOD = "不支持的HTTP方法";
    
    private SignConstants() {
        // 工具类不允许实例化
    }
}